import { Controller, UseInterceptors, UploadedFile, Post, UseGuards } from '@nestjs/common'
import { UploadService } from './upload.service';
import { FileInterceptor } from '@nestjs/platform-express'
import { AuthGuard } from '@nestjs/passport';

@Controller('upload')
@UseGuards(AuthGuard('jwt'))
export class UploadController {
    constructor(private readonly uploadService: UploadService) { }

    @Post()
    @UseInterceptors(FileInterceptor('file'))
    upload(@UploadedFile() file: Express.Multer.File) {
        return `files/${file.filename}`
    }
}
